<template>
    <div class="loop">
        <div style="display: flex;">
            <div style="margin-right: 15px;">
                <el-button @click="addLoop" icon="el-icon-thumb" type="primary" size="mini">
                    添加轮播图
                </el-button>
            </div>
                <!-- 测试数据 -->
                <!-- https://t7.baidu.com/it/u=3655946603,4193416998&fm=193&f=GIF -->
        </div>
        <el-dialog title="添加轮播图" :visible.sync="isAddShow" width="650px" :before-close="handleClose">
            <el-form ref="formList" :model="formList" label-width="90px">
                <el-form-item label="顺序号：">
                    <el-input v-model="formList.loop_id" disabled placeholder=""></el-input>
                </el-form-item>
                <el-form-item label="图片地址：">
                    <el-input v-model="formList.loop_pic" placeholder="请输入图片地址"></el-input>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" @click="submitForm()" size="small">添加</el-button>
                    <el-button type="warning" @click="clearForm()" size="small">清空</el-button>
                </el-form-item>
            </el-form>
        </el-dialog>
        <el-table stripe height="470" :data="loopList" style="width: 100%" class="looptab">
            <el-table-column label="顺序号" width="70">
                <template slot-scope="scope">
                    <span style="margin-left: 10px">{{ scope.row.loop_id }}</span>
                </template>
            </el-table-column>
            <el-table-column label="图片地址" width="500">
                <template slot-scope="scope">
                    <span style="margin-left: 10px">{{ scope.row.loop_pic }}</span>
                </template>
            </el-table-column>
            <el-table-column label="图片" width="140">
                <template slot-scope="scope">
                    <img :src="scope.row.loop_pic" alt="" width="100">
                </template>
            </el-table-column>
            <el-table-column label="操作" width="220">
                <template slot-scope="scope">
                    <el-button icon="el-icon-top" size="mini" type="primary" plain
                        @click="upLoop(scope.row.loop_id)"></el-button>
                    <el-button icon="el-icon-bottom" size="mini" type="primary" plain
                        @click="downLoop(scope.row.loop_id)"></el-button>
                    <el-button icon="el-icon-delete" size="mini" type="danger"
                        @click="handleDelete(scope.row._id)">删除</el-button>
                </template>
            </el-table-column>
        </el-table>
    </div>
</template>
<script src="../assets/js/LoopManageView.js"></script>
<style src="../assets/css/LoopManageView.css" scoped></style>